<template>

    <!--筛选条件-->
    <div class="shaixuan3">
        <div style="margin-top: 15px;">
            <el-input placeholder="搜索关键词" v-model="input" class="input-with-select" style="width: 400px;">
                <el-select v-model="typeinput" slot="prepend" placeholder="请选择"  style="width: 130px;">
                    <el-option label="发布者昵称" value="1"></el-option>
                    <el-option label="发布内容" value="2"></el-option>
                </el-select>
                <el-button slot="append" icon="el-icon-search" @click="searchtype"></el-button>
            </el-input>
            <PersButton type="text" size="mini" icon="el-icon-refresh" perms="sys:role:del" label="刷新" @click="refresh()"></PersButton>
        </div>
        <div class="first_table">

            <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" border stripe default-expand-all v-loading="loading" >
                <el-table-column align="center" fixed  width="55" label="序号"  prop="id"></el-table-column>
                <el-table-column align="center" prop="tutor_name" label="发布者" header-align="center"></el-table-column>
                <el-table-column align="center" prop="from" label="状态" header-align="center">
                    <template slot-scope="scope">
                        <span>
                            {{ scope.row.show === true ? '已上墙' : '已下强' }}
                        </span>
                    </template>
                </el-table-column>
                <el-table-column  align="center"  header-align="center" prop="imgList" label="图片">
                    <template slot-scope="scope">
                        <el-image v-for="(item, index) in scope.row.imgList" :key="index" :src="item" fit="fill" style="width: 60px;height: 60px;"></el-image>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="txt" label="内容" header-align="center"></el-table-column>
                <el-table-column align="center" prop="send_time" label="发布时间" header-align="center"></el-table-column>
            </el-table>
            <div class="block">
                <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNumber" :page-sizes="[10, 50, 100, 200]" :page-size="pageSize" background layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </div>
        </div>
    </div>
</template>


<script>
    import {getBlackbordList} from '@/api/live/action';
    import PersButton from '@/components/PersButton';
    export default {
        components: {
            PersButton
        },
        props:{
            liveId:{
                type:String,
                default:''
            },
            liveTitle:{
                type:String,
                default:''
            },
        },
        data(){
            return {
                pageSize: 10, //一页显示多少条
                pageNumber: 1,
                total: 0, //总页数
                input:'',
                typeinput:'1',
                tableData:[],
                loading: false,
                multipleSelectioncount: 0,
            }
        },
        created(){
            this.init();
        },
        methods: {
            refresh(e){
                this.init();
            },
            resetForm(formName) {
                this.input = '';
                this.init();
            },
            init(){
                let _param = {
                    liveId:this.$props.liveId,
                    input:this.input,
                    typeinput:this.typeinput,
                    pageSize:this.pageSize,
                    pageNumber:this.pageNumber
                }
                getBlackbordList(_param).then((res) => {
                    if (res.code == 200) {
                        this.tableData = res.data.list;
                        this.total = res.data.total;
                    } else {
                        this.msgError(res.msg);
                    }
                })
            },
            searchtype(e){
                this.init();
            },
            handleSizeChange: function (e) {
                console.log(e);
                this.pageSize = e;
                this.init();
            },
            handleCurrentChange: function (e) {
                console.log(e);
                this.pageNumber = e;
                this.init();
            }

        }

    }

</script>


<style>
    .yixuan {
        margin: 20px;
        color: #787878;
    }
</style>